<?php

/** 
 * 推荐位接口  主要是获取推荐位的视频信息
 * @author Legend. <xcx_legender@qq.com>
 * @param 
 * @return 
 */

namespace Api\Event;

class RecommendEvent extends BaseEvent 
{

	// 获取首页头条的信息
	public function getLists($pos = 'home')
	{
		$ser = D('Common/Recommend', 'Service');
		$map['status']  = 1;
		$map['pos'] 	= $pos;
		$res = $ser->where($map)->order('sort desc, id desc')->select();
		foreach ($res as $key => $value) {
			uri_format($value['thumb']);
			uri_format($value['cover']);
			$video = A('Api/Video', 'Event')->detail($value['video_id']);
			$value['uri'] = $video['uri'];
			$value['pre_uri'] = $video['pre_uri'];
			$value['thumb_large'] = $value['cover'];
			$value['thumb_small'] = $value['thumb'];
			$value['title'] = $video['title'];
			$value['game'] = $video['game']['name'];
			$value['thumb_video'] = $video['thumb'];
			uri_format($value['thumb_video']);
			$list[] = $value;
		}
		return $list;
	}

}